import {
    createHashRouter
} from "react-router-dom";
import React from "react";
import PageOne from '../auth/page-one/index'
import PageTwo from '../auth/page-two/index'
import PageThree from '../auth/page-three/index'

// 定义一个新的类型，包含 Window 和自定义属性
type WindowWithCustomVars = Window & {
    __POWERED_BY_QIANKUN__: {
        onGlobalStateChange:(params:((state:any)=>void))=>void,
        setGlobalState:(params:any)=>void
    };
};
  
// 声明 window 为新的类型
declare let window: WindowWithCustomVars;

const router = createHashRouter([
    {
        path: "/",  // 实际路径为 /auth/subapp
        element: <PageOne />,
    },
    {
        path: "/auth/subapp/page-one",
        element: <PageOne />,
    },
    {
        path: "/auth/subapp/page-two",
        element: <PageTwo />,
    },
    {
        path: "/auth/subapp/page-three",
        element: <PageThree />,
    },
    {
        path: '*', 
        element: <PageOne />, // 404 页面
    },
]);

//,{basename:window.__POWERED_BY_QIANKUN__?'/auth/subapp':'/auth/subapp'}

export default router;


  